from Crypto.Cipher import AES
from base64 import b64decode, b64encode, urlsafe_b64encode, urlsafe_b64decode
from Crypto.Util.Padding import pad, unpad


text = "汪汪特工队"
k = "2bfc6f1644b02c3c1ed658829352b095"
k = "uMOQkzkXv/qzUz1XZ2ko+A=="
k = "870794bc135c41349bd4214854fc9b1c"
# for i in k.encode():
#     print(i)
# a = [-72, -61, -112, -109, 57, 23, -65, -6, -77, 83, 61, 87, 103, 105, 40, -8]


def encrypt(text):
    text = pad(text.encode(), block_size=AES.block_size)
    cipher = AES.new(k.encode(), AES.MODE_ECB)
    etext = cipher.encrypt(text)
    s = b64encode(etext).decode()
    return s


def decrypt(etext):
    cipher = AES.new(k.encode(), AES.MODE_ECB)
    text = cipher.decrypt(b64decode(etext))
    s = unpad(text, cipher.block_size).decode("utf-8")
    return s


print(encrypt(text))
print(decrypt(encrypt(text)))
print(decrypt("S9C8mOcxDiGNXmgru5jD8Q=="))
print(decrypt("Liju2g3oNGMqg23t7c5U7w=="))


print(0x00)
